package com.csi.okr.common.util;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

public class BasicValueUtil {

	/**
	 * 查询其实年份当前年份集合
	 * @return
	 */
	public static List<Integer> getDate2Now() {
		//储存年份列表
		List<Integer> years = new ArrayList<Integer>();
		//开始年份
		int startYear = 2016;
		//当前年份
		int year = Calendar.getInstance().get(Calendar.YEAR);
		//循环增加到集合
		for (int i = startYear; i <= year; i++) {
			years.add(i);
		}
		//返回
		return years;
	}

	public static void main(String[] args) {
		String sql = "SELECT DISTINCT O.*,"+
				"B.CODE_NAME,"+
				"B.SORT_ID,"+
				"s.O_SCORE_UUID as oScoreUuid,"+
				"s.O_SCORE_SUPERIOR as oScoreSuperior"+
				" FROM T_OKR_OBJECTIVES O"+
				" LEFT JOIN T_OKR_BASECODE_CODE B ON O.O_STATE = B.CODE_NO AND B.BASECODE = 'OS' "+
				" left join T_OKR_SCORE_DETAIL_OBJECTIVES s ON o.O_UNIQUE_ID_CODE = s.O_UNIQUE_ID_CODE "+
				" WHERE O.person_liable_code = 'emplCode'and O.OWNER_DEPTCODE='orgCode";
		sql += " and (O.Designated_Applyer_Code = 'emplCode' OR (O.IS_VISIBLE_DESIGNATED = 1 AND O.O_UNIQUE_ID_CODE =  "+
				" (select v.o_unique_id_code from T_OKR_DESIGNATED_VISIBLE v  "+
				" where v.o_unique_id_code = O.O_UNIQUE_ID_CODE and v.designatede_person_code='emplCode') OR o.IS_VISIBLE_OVERALL=1) ";
		System.out.println(sql);
	}
}
